package com.ymatou.iapi.productcategory.testcase;

import java.util.ArrayList;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.productcategory.parameter.BrandInfo;
import com.ymatou.iapi.productcategory.parameter.QueryBrandInfoListBean;
import com.ymatou.iapi.productcategory.service.QueryBrandInfoListCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.database.mongo.BuyerProductWapper;
/**
*查询品牌详细信息列表（后台）
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_QueryBrandInfoList{
	private static QueryBrandInfoListBean querybrandinfolistBean;
	private static QueryBrandInfoListCall querybrandinfolistCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询品牌详细信息列表（后台）");
	}

	@Before
	public void caseUp() {
		querybrandinfolistBean=new QueryBrandInfoListBean();
		querybrandinfolistCall=new QueryBrandInfoListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(querybrandinfolistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryBrandInfoList_001() {
		Logger.start(true,"查询品牌详细信息列表（后台）");
		try {
			BuyerProductWapper pbinfow = new BuyerProductWapper();
			ArrayList<Map> list = pbinfow.getProductBrandInfoById(21570);
			Map map = list.get(0);
			String enName = map.get("BrandEnName").toString();
			querybrandinfolistBean.setEnName(enName);
			querybrandinfolistBean.setPageIndex(1);
			querybrandinfolistCall.setData(querybrandinfolistBean);
			querybrandinfolistCall.callService();			
			Logger.verifyEquals("200", querybrandinfolistCall.getString("Code"), "验证Code");
			querybrandinfolistCall.getBrandInfoList().forEach(pp->{
				Logger.verifyEquals(map.get("BrandId"), pp.getId(), "验证id");
				Logger.verifyEquals(map.get("KeyWord"), pp.getKeyWord(), "验证KeyWord");
				Logger.verifyEquals(map.get("BrandEnName"), pp.getEnName(), "验证BrandEnName");
				Logger.verifyEquals(map.get("CountryId"), pp.getCountryId(), "验证CountryId");
				Logger.verifyEquals(map.get("BrandLogoUrl"), pp.getLogoUrl(), "验证LogoUrl");
				Logger.verifyEquals(map.get("BrandBannerUrl"), pp.getBannerUrl(), "验证BrandBannerUrl");
			});
			pbinfow.close();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}